<?php 
$dbcnx = mysqli_connect("216.185.102.20", "darylho","8604923?", "mfidatabase");
/* check connection */
if (mysqli_connect_errno()) {
    printf("Connect failed: %s\n", mysqli_connect_error());
    exit();
}

$user_id = '';
$passwd = '';

//variable user to insert into table
$user_id=$_POST['username'];
$passwd=$_POST['password'];
$invalidusername = "invalid username";


//search query for username in data 

$searchuserquery = "SELECT username, password FROM agentable WHERE `username` = '$user_id' AND `password` = '$passwd'";

if ($result = mysqli_query($dbcnx,$searchuserquery)) {
	while($obj = mysqli_fetch_array($result)){
		extract($obj);
		if($username == $user_id){
			echo "Welcome, $user_id:test";
		}
		else if ($username != $user_id){
		echo "Invalid!:test";
		}
	}
	
	
	
	}
	else {
	printf ("fail:test");
	}
	
	 /* free result set */
    mysqli_free_result($result);
	
	
mysqli_close($dbcnx);



?>